<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="f" uri="http://www.jspxcms.com/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>网站管理平台 - Powered by 珍医网</title>
    <jsp:include page="/WEB-INF/views/commons/head.jsp"></jsp:include>
    <script type="text/javascript">
        $(function () {
            $("#validForm").validate();
            $("input[name='name']").focus();
        });
        function confirmDelete() {
            return confirm("<s:message code='confirmDelete'/>");
        }
    </script>
</head>
<body class="c-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="c-bar margin-top5">
    <span class="c-position"><s:message code="resume.management"/> - <s:message code="${oprt=='edit' ? 'edit' : 'create'}"/></span>
</div>
<form id="validForm" action="${oprt=='edit' ? 'update' : 'save'}.do" method="post">
    <tags:search_params/>
    <f:hidden name="oid" value="${bean.id}"/>
    <f:hidden name="position" value="${position}"/>
    <input type="hidden" id="redirect" name="redirect" value="edit"/>
    <table border="0" cellpadding="0" cellspacing="0" class="in-tb margin-top5">
        <tr>
            <td colspan="4" class="in-opt">
                <shiro:hasPermission name="plug:gift:create">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="create"/>" onclick="location.href='create.do?${searchstring}';"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                    <div class="in-btn"></div>
                </shiro:hasPermission>
                <shiro:hasPermission name="plug:gift:copy">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="copy"/>" onclick="location.href='create.do?id=${bean.id}&${searchstring}';"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                </shiro:hasPermission>
                <shiro:hasPermission name="plug:gift:delete">
                    <div class="in-btn">
                        <input type="button" value="<s:message code="delete"/>" onclick="if(confirmDelete()){location.href='delete.do?ids=${bean.id}&${searchstring}';}"
                                <c:if test="${oprt=='create'}"> disabled="disabled"</c:if>/></div>
                </shiro:hasPermission>
                <div class="in-btn"></div>
                <div class="in-btn">
                    <input type="button" value="<s:message code="prev"/>" onclick="location.href='edit.do?id=${side.prev.id}&position=${position-1}&${searchstring}';"
                            <c:if test="${empty side.prev}"> disabled="disabled"</c:if>/></div>
                <div class="in-btn">
                    <input type="button" value="<s:message code="next"/>" onclick="location.href='edit.do?id=${side.next.id}&position=${position+1}&${searchstring}';"
                            <c:if test="${empty side.next}"> disabled="disabled"</c:if>/></div>
                <div class="in-btn"></div>
                <div class="in-btn">
                    <input type="button" value="<s:message code="return"/>" onclick="location.href='list.do?${searchstring}';"/>
                </div>
                <div style="clear:both;"></div>
            </td>
        </tr>
        <tr>
            <td class="in-lab" width="15%"><em class="required">*</em>礼品名字:</td>
            <td class="in-ctt" width="35%">
                <f:text name="goodsTitle" value="${oprt=='edit' ? (bean.goodsTitle) : ''}" class="required" maxlength="100" style="width:180px;"/></td>

        </tr>
        <tr>
            <td class="in-lab" width="15%"><em class="required">*</em>所需积分:</td>
            <td class="in-ctt" width="35%">
                <f:text name="post" value="${bean.goodsScore}" class="required" maxlength="100" style="width:180px;"/></td>
            <td class="in-lab" width="15%">
                <c:if test="${oprt=='edit'}"><em class="required">*</em></c:if>申请日期:
            </td>
            <td class="in-ctt" width="35%">
                <input type="text" name="creationDate" value="<c:if test="${oprt=='edit'}"><fmt:formatDate value="${bean.creationDate}" pattern="yyyy-MM-dd'T'HH:mm:ss"/></c:if>" onclick="WdatePicker({dateFmt:'yyyy-MM-ddTHH:mm:ss'});" class="${oprt=='edit' ? 'required' : ''}" style="width:180px;"/>
            </td>
        </tr>
        <tr>
            <td class="in-lab" width="15%">联系电话:</td>
            <td class="in-ctt" width="35%">
                <f:text name="phone" value="${bean.phone}" maxlength="100" style="width:180px;"/></td>
            <td class="in-lab" width="15%">联系地址:</td>
            <td class="in-ctt" width="35%">
                <f:text name="address" value="${bean.address}" maxlength="100" style="width:180px;"/></td>
        </tr>
        <tr>
            <td class="in-lab" width="15%">申请人:</td>
            <td class="in-ctt" width="35%">${userDetail.user.username}</td>
            <td class="in-lab" width="15%">现有积分:</td>
            <td class="in-ctt" width="35%">${userDetail.score}</td>
        </tr>

        <tr>
            <td colspan="4" class="in-opt">
                <div class="in-btn"><input type="submit" value="通过" onclick="return submitForm(1)"/></div>
                <div class="in-btn"><input type="submit" value="拒绝" onclick="return submitForm(0)"/></div>

                <div style="clear:both;"></div>
            </td>
        </tr>
    </table>
    <input type="hidden" name="state" value="0"/>
    <script type="text/javascript">
        function submitForm(success) {
            $("input[name='state']").val(success);
            $("#validForm").submit();
            return false;
        }
    </script>
</form>
</body>
</html>